package com.student.controller;

import com.student.VO.SnackVO;
import com.student.dto.ResponseDto;
import com.student.pojo.Words;
import com.student.service.WordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: SupportGroup
 * @BelongsPackage: com.student.controller
 * @Author: 小徐
 * @CreateTime: 2025-03-04 09:22
 * @Description: TODO
 * @Version: 1.0
 */
@RequestMapping("words")
@RestController
public class WordsController {
    @Autowired
    private WordsService wordsService;

    /**
     * 请求违禁词的所有信息
     *
     * @return
     */
    @RequestMapping("getAllWord")
    public ResponseDto getAllWord(@RequestBody Words words) {
        return wordsService.getAllWord(words);
    }

    /**
     * 添加违禁词信息
     *
     * @param words
     * @return
     */
    @RequestMapping("addWords")
    public ResponseDto addWords(@RequestBody Words words) {
        return wordsService.addWords(words);
    }

    /**
     * 修改违禁词信息
     *
     * @param words
     * @return
     */
    @RequestMapping("updateWords")
    public ResponseDto updateWords(@RequestBody Words words) {
        return wordsService.updateWords(words);
    }

    /**
     * 删除违禁词信息
     *
     * @param id
     * @return
     */
    @RequestMapping("deleteWords")
    public ResponseDto deleteWords(@RequestParam("id") Integer id) {
        return wordsService.deleteWords(id);
    }

    /**
     * 添加评论
     *
     * @param snackVO
     * @return
     */
    @RequestMapping("addTaking")
    public ResponseDto addTaking(@RequestBody SnackVO snackVO) {
        System.err.println(snackVO);
        return wordsService.addTaking(snackVO);
    }

    @RequestMapping("getComments")
    public ResponseDto getComments(@RequestParam("id") Integer id) {
        return wordsService.getComments(id);
    }

    @RequestMapping("addReply")
    public ResponseDto addReply(@RequestBody SnackVO snackVO) {
        System.err.println(snackVO);
        return wordsService.addReply(snackVO);
    }

}